package com.ruoyi.user.domain;

import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;

/**
 * 用户订单对象 user_order
 *
 * @author houyong
 * @date 2025-11-20
 */
@Schema(name = "UserOrder", description = "用户订单对象")
public class UserOrder extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @Schema(description = "主键id")
    private Long id;

    /**
     * 支付宝的交易号
     */
    @Schema(description = "支付宝的交易号")
    private String alipayTradeNo;

    /**
     * 订单金额（分）
     */
    @Excel(name = "订单金额", readConverterExp = "分=")
    @Schema(description = "订单金额（分）")
    private Integer amount;

    /**
     * 订单描述
     */
    @Excel(name = "订单描述")
    @Schema(description = "订单描述")
    private String body;

    /**
     * 支付宝支付，买家支付宝用户号
     */
    @Schema(description = "支付宝支付，买家支付宝用户号")
    private String buyerId;

    /**
     * 买家支付宝账号
     */
    @Schema(description = "买家支付宝账号")
    private String buyerLogonId;

    /**
     * 支付方式：
     * alipay
     * alipay_xcx
     * wx
     * wx_xcx
     * wxpub
     * unionpay
     * unionpay_xcx
     * jglh_account
     */
    @Excel(name = "支付方式")
    @Schema(description = "支付方式：alipay,alipay_xcx,wx,wx_xcx,wxpub")
    private String channel;

    /**
     * 支付金额(分）创建订单时使用
     */
    @Excel(name = "支付金额(分）创建订单时使用")
    @Schema(description = "支付金额(分）创建订单时使用")
    private Integer fee;

    /**
     * 订单标题
     */
    @Excel(name = "订单标题")
    @Schema(description = "订单标题")
    private String goodsSubject;

    /**
     * 订单id
     */
    @Excel(name = "订单id")
    @Schema(description = "订单id")
    private String orderId;

    /**
     * 付款时间
     */
    @Excel(name = "付款时间")
    @Schema(description = "付款时间")
    private Long payTime;

    /**
     * 退款时间
     */
    @Excel(name = "退款时间")
    @Schema(description = "退款时间")
    private Long refundTime;


    @Schema(description = "订单退款开始日期")
    private Long beginRefundTime;
    @Schema(description = "订单退款开始日期")
    private Long endRefundTime;

    @Schema(description = "订单创建结束日期")
    private Long beginPayTime;
    @Schema(description = "订单创建结束日期")
    private Long endPayTime;

    /**
     * 支付之后，第三方返回的支付结果的json字符串
     */
    @Schema(description = "支付之后，第三方返回的支付结果的json字符串")
    private String result;

    /**
     * 支付状态
     * 2：支付成功
     * 1：未支付
     * -1：已退款
     */
    @Excel(name = "支付状态")
    @Schema(description = "支付状态: 2-支付成功, 1-未支付, -1-已退款")
    private Integer status;

    /**
     * 订单创建时间
     */
    @Excel(name = "订单创建时间")
    @Schema(description = "订单创建时间")
    private Long t;


    @Schema(description = "订单创建开始时间")
    private Long beginT;

    @Schema(description = "订单创建结束时间")
    private Long endT;


    /**
     * 支付金额（元）创建订单时使用
     */
    @Schema(description = "支付金额（元）创建订单时使用")
    private BigDecimal totalFee;

    /**
     * 支付金额信息
     * 支付成功的各个渠道金额信息
     * 例如：[{“amount”:“15.00”,“fundChannel”:“ALIPAYACCOUNT”}]
     * COUPON	支付宝红包
     * ALIPAYACCOUNT	支付宝余额
     * POINT	集分宝
     * DISCOUNT	折扣券
     * PCARD	预付卡
     * FINANCEACCOUNT	余额宝
     * MCARD	商家储值卡
     * MDISCOUNT	商户优惠券
     * MCOUPON	商户红包
     * PCREDIT	蚂蚁花呗
     * <p>
     * <p>
     * <p>
     * 微信：
     * pay.weixin.app   微信app支付
     */
    @Schema(description = "支付金额信息，支付成功的各个渠道金额信息")
    private String tradeType;

    /**
     * 微信的支付交易号
     */
    @Schema(description = "微信的支付交易号")
    private String transactionId;

    /**
     * 支付截止日期
     */
    @Excel(name = "支付截止日期")
    @Schema(description = "支付截止日期")
    private Long payTimeout;

    /**
     * 下单人uid
     */
    @Excel(name = "下单人uid")
    @Schema(description = "下单人uid")
    private String uid;

    /**
     * 微信用户openid当channel为wx_xcx时用
     */
    @Schema(description = "微信用户openid当channel为wx_xcx时用")
    private String openid;

    /**
     * 手续费
     */
    @Excel(name = "手续费")
    @Schema(description = "手续费")
    private BigDecimal serverCharge;

    /**
     * 需要支付的金额 分
     */
    @Schema(description = "需要支付的金额(分)")
    private Integer needPayFee;

    /**
     * x要支付的金额 元
     */
    @Schema(description = "需要支付的金额(元)")
    private BigDecimal needPayTotalFee;

    /**
     * 商品id
     */
    @Excel(name = "商品id")
    @Schema(description = "商品id")
    private Integer goodsId;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getAlipayTradeNo() {
        return alipayTradeNo;
    }

    public void setAlipayTradeNo(String alipayTradeNo) {
        this.alipayTradeNo = alipayTradeNo;
    }


    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getBuyerId() {
        return buyerId;
    }

    public void setBuyerId(String buyerId) {
        this.buyerId = buyerId;
    }

    public String getBuyerLogonId() {
        return buyerLogonId;
    }

    public void setBuyerLogonId(String buyerLogonId) {
        this.buyerLogonId = buyerLogonId;
    }

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }


    public String getGoodsSubject() {
        return goodsSubject;
    }

    public void setGoodsSubject(String goodsSubject) {
        this.goodsSubject = goodsSubject;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public Long getPayTime() {
        return payTime;
    }

    public void setPayTime(Long payTime) {
        this.payTime = payTime;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }


    public Long getT() {
        return t;
    }

    public void setT(Long t) {
        this.t = t;
    }

    public BigDecimal getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(BigDecimal totalFee) {
        this.totalFee = totalFee;
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public Long getPayTimeout() {
        return payTimeout;
    }

    public void setPayTimeout(Long payTimeout) {
        this.payTimeout = payTimeout;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public BigDecimal getServerCharge() {
        return serverCharge;
    }

    public void setServerCharge(BigDecimal serverCharge) {
        this.serverCharge = serverCharge;
    }


    public BigDecimal getNeedPayTotalFee() {
        return needPayTotalFee;
    }

    public void setNeedPayTotalFee(BigDecimal needPayTotalFee) {
        this.needPayTotalFee = needPayTotalFee;
    }


    public Long getBeginPayTime() {
        return beginPayTime;
    }

    public void setBeginPayTime(Long beginPayTime) {
        this.beginPayTime = beginPayTime;
    }

    public Long getEndPayTime() {
        return endPayTime;
    }

    public void setEndPayTime(Long endPayTime) {
        this.endPayTime = endPayTime;
    }

    public Long getBeginT() {
        return beginT;
    }

    public void setBeginT(Long beginT) {
        this.beginT = beginT;
    }

    public Long getEndT() {
        return endT;
    }

    public void setEndT(Long endT) {
        this.endT = endT;
    }

    public Long getRefundTime() {
        return refundTime;
    }

    public void setRefundTime(Long refundTime) {
        this.refundTime = refundTime;
    }

    public Long getBeginRefundTime() {
        return beginRefundTime;
    }

    public void setBeginRefundTime(Long beginRefundTime) {
        this.beginRefundTime = beginRefundTime;
    }

    public Long getEndRefundTime() {
        return endRefundTime;
    }

    public void setEndRefundTime(Long endRefundTime) {
        this.endRefundTime = endRefundTime;
    }

    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    public Integer getFee() {
        return fee;
    }

    public void setFee(Integer fee) {
        this.fee = fee;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getNeedPayFee() {
        return needPayFee;
    }

    public void setNeedPayFee(Integer needPayFee) {
        this.needPayFee = needPayFee;
    }

    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("alipayTradeNo", getAlipayTradeNo())
                .append("amount", getAmount())
                .append("body", getBody())
                .append("buyerId", getBuyerId())
                .append("buyerLogonId", getBuyerLogonId())
                .append("channel", getChannel())
                .append("fee", getFee())
                .append("goodsSubject", getGoodsSubject())
                .append("orderId", getOrderId())
                .append("payTime", getPayTime())
                .append("result", getResult())
                .append("status", getStatus())
                .append("t", getT())
                .append("totalFee", getTotalFee())
                .append("tradeType", getTradeType())
                .append("transactionId", getTransactionId())
                .append("payTimeout", getPayTimeout())
                .append("uid", getUid())
                .append("openid", getOpenid())
                .append("serverCharge", getServerCharge())
                .append("needPayFee", getNeedPayFee())
                .append("needPayTotalFee", getNeedPayTotalFee())
                .append("goodsId", getGoodsId())
                .toString();
    }
}
